home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / cvs-1_3.lha / cvs-1.3 / lib / system.h < prev    next >
C/C++ Source or Header  |  1992-04-09  |  5KB  |  222 lines

  1. /* system-dependent definitions for CVS.
  2.    Copyright (C) 1989-1992 Free Software Foundation, Inc.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  17.  
  18. /* @(#)system.h 1.14 92/04/10 */
  19.  
  20. #ifdef __GNUC__
  21. #define alloca __builtin_alloca
  22. #else
  23. #ifdef sparc
  24. #include <alloca.h>
  25. #else
  26. #ifndef _AIX
  27. /* AIX alloca decl has to be the first thing in the file, bletch! */
  28. char *alloca ();
  29. #endif
  30. #endif
  31. #endif
  32.  
  33. #include <sys/types.h>
  34. #include <sys/stat.h>
  35. #ifndef S_ISREG            /* Doesn't have POSIX.1 stat stuff. */
  36. #ifndef mode_t
  37. #define mode_t unsigned short
  38. #endif
  39. #endif
  40. #if !defined(S_ISBLK) && defined(S_IFBLK)
  41. #define    S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  42. #endif
  43. #if !defined(S_ISCHR) && defined(S_IFCHR)
  44. #define    S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  45. #endif
  46. #if !defined(S_ISDIR) && defined(S_IFDIR)
  47. #define    S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  48. #endif
  49. #if !defined(S_ISREG) && defined(S_IFREG)
  50. #define    S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  51. #endif
  52. #if !defined(S_ISFIFO) && defined(S_IFIFO)
  53. #define    S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  54. #endif
  55. #if !defined(S_ISLNK) && defined(S_IFLNK)
  56. #define    S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  57. #endif
  58. #if !defined(S_ISSOCK) && defined(S_IFSOCK)
  59. #define    S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  60. #endif
  61. #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
  62. #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
  63. #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
  64. #endif
  65. #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
  66. #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
  67. #endif
  68. #if defined(MKFIFO_MISSING)
  69. #define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
  70. #endif
  71.  
  72. #ifdef POSIX
  73. #include <unistd.h>
  74. #include <limits.h>
  75. #ifndef PATH_MAX
  76. #define PATH_MAX pathconf ("/", _PC_PATH_MAX)
  77. #endif
  78. #else
  79. off_t lseek ();
  80. #endif
  81.  
  82. #ifdef TM_IN_SYS_TIME
  83. #include <sys/time.h>
  84. #else
  85. #include <time.h>
  86. #endif
  87.  
  88. #ifdef TIMEB_H_MISSING
  89. struct timeb {
  90.     time_t        time;        /* Seconds since the epoch    */
  91.     unsigned short    millitm;    /* Field not used        */
  92. #ifdef timezone
  93.     short        tzone;
  94. #else
  95.     short        timezone;
  96. #endif
  97.     short        dstflag;    /* Field not used        */
  98. };
  99. #else
  100. #include <sys/timeb.h>
  101. #endif
  102.  
  103. #if defined(FTIME_MISSING) && !defined(HAVE_TIMEZONE)
  104. #if !defined(timezone)
  105. extern long timezone;
  106. #endif
  107. #endif
  108.  
  109. #ifndef POSIX
  110. #include <sys/param.h>
  111. #endif
  112.  
  113. #ifndef _POSIX_PATH_MAX
  114. #define _POSIX_PATH_MAX 255
  115. #endif
  116.  
  117. #ifndef PATH_MAX
  118. #ifdef MAXPATHLEN
  119. #define PATH_MAX MAXPATHLEN
  120. #else
  121. #define PATH_MAX _POSIX_PATH_MAX
  122. #endif
  123. #endif
  124.  
  125. #ifdef POSIX
  126. #include <utime.h>
  127. #else
  128. #ifndef ALTOS
  129. struct utimbuf
  130. {
  131.   long actime;
  132.   long modtime;
  133. };
  134. #endif
  135. int utime ();
  136. #endif
  137.  
  138. #if defined(USG) || defined(STDC_HEADERS)
  139. #include <string.h>
  140. #ifndef STDC_HEADERS
  141. #include <memory.h>
  142. #endif
  143. #ifndef index
  144. #define index strchr
  145. #endif
  146. #ifndef rindex
  147. #define rindex strrchr
  148. #endif
  149. #ifndef bcopy
  150. #define bcopy(from, to, len) memcpy ((to), (from), (len))
  151. #endif
  152. #ifndef bzero
  153. #define bzero(s, n) (void) memset ((s), 0, (n))
  154. #endif
  155. #ifndef bcmp
  156. #define    bcmp(s1, s2, n) memcmp((s1), (s2), (n))
  157. #endif
  158. #else
  159. #include <strings.h>
  160. #endif
  161.  
  162. #include <errno.h>
  163. #ifdef STDC_HEADERS
  164. #include <stdlib.h>
  165. #else
  166. char *getenv ();
  167. char *malloc ();
  168. char *realloc ();
  169. char *calloc ();
  170. extern int errno;
  171. #endif
  172.  
  173. #if defined(USG) || defined(POSIX)
  174. #include <fcntl.h>
  175. char *getcwd ();
  176. #else
  177. #include <sys/file.h>
  178. char *getwd ();
  179. #endif
  180.  
  181. #ifndef SEEK_SET
  182. #define SEEK_SET 0
  183. #define SEEK_CUR 1
  184. #define SEEK_END 2
  185. #endif
  186. #ifndef F_OK
  187. #define F_OK 0
  188. #define X_OK 1
  189. #define W_OK 2
  190. #define R_OK 4
  191. #endif
  192.  
  193. #ifdef DIRENT
  194. #include <dirent.h>
  195. #ifdef direct
  196. #undef direct
  197. #endif
  198. #define direct dirent
  199. #else
  200. #ifdef SYSNDIR
  201. #include <sys/ndir.h>
  202. #else
  203. #ifdef NDIR
  204. #include <ndir.h>
  205. #else /* must be BSD */
  206. #include <sys/dir.h>
  207. #endif
  208. #endif
  209. #endif
  210.  
  211. /* Convert B 512-byte blocks to kilobytes if K is nonzero,
  212.    otherwise return it unchanged. */
  213. #define convert_blocks(b, k) ((k) ? ((b) + 1) / 2 : (b))
  214.  
  215. #ifndef S_ISLNK
  216. #define lstat stat
  217. #endif
  218.  
  219. #ifndef SIGTYPE
  220. #define SIGTYPE void
  221. #endif
  222.